﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="fhdb" content="true">
    <title>佣金榜</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/commissionTop.css">
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div class="backBox" onClick="javascript:history.back(-1);">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </div>
    <div class="topTitle">
        佣金榜
    </div>
    <!-- 顶部导航 -->
    <div class="topNav">
        <div class="navBox checked">
            <div>
                排行榜
            </div>
        </div>
<!--        <div class="navBox">-->
<!--            <div>-->
<!--                周榜-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="navBox ">-->
<!--            <div>-->
<!--                月榜-->
<!--            </div>-->
<!--        </div>-->
    </div>
    <!-- 榜单 -->
    <div class="bd_banner">
        <div class="bd_title"><span class="bd_title_font">本日佣金排行榜</span><img src="images/huo.png" /></div>
    </div>
    <div class="bd_bdxq">
       
    </div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        bangdan("日榜");
        $('.topNav').on('click', '.navBox', function () {
            const $this = $(this)
            const index = $this.index()
            var text = $this[0].innerText;
            $this.addClass('checked').siblings().removeClass('checked')
            if ($.trim(text) == "日榜") {
                $(".bd_title_font").text("本日佣金排行榜");
                bangdan("日榜");
            }
            if ($.trim(text) == "周榜") {
                $(".bd_title_font").text("本周佣金排行榜");
                bangdan("周榜");
            }
            if ($.trim(text) == "月榜") {
                $(".bd_title_font").text("本月佣金排行榜");
                bangdan("月榜");
            }
        })
    })
    function bangdan(state) {
        $.ajax({
            type: "POST",
            data: { state: state },
            url: "/yongjin/list",
            success: function (data) {
                if (data.msg == "_timeout") {
                    window.location.href = "../UserLogin/Login.html";
                }
                else {
                    var html = "";
                    for (var i = 0; i < data.length; i++) {
                        var num = i + 1;
                        html += '<div class="bd_bdxq_top">';
                        if (i == 0) {
                            html += '<div><img src="images/jin.png" style="width:20px; height:20px;" /></div>';
                        } else if (i == 1) {
                            html += '<div><img src="images/yin.png" style="width:20px; height:20px;" /></div>';
                        } else if (i == 2) {
                            html += '<div><img src="images/tong.png" style="width:20px; height:20px;" /></div>';
                        } else {
                            html += '<div style = "width:20px;" > ' + num + '、</div>';
                        }
                        html += '<div>' + data[i].TB_YJ_USER + '</div>';
                        html += '<div>￥' + data[i].TB_YJ_PRICE + '</div>';
                        html += '</div>';
                    }
                    $(".bd_bdxq").empty();
                    $(".bd_bdxq").append(html);
                }
            }
        });
    }
</script>